﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Licenta3"
    xmlns:converters="clr-namespace:Licenta3.converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" x:Name="SetariForm" x:Class="TSetariForm"
    
    Title="Setari" Height="269" Width="700"
         ShowInTaskbar="False" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" >
    <Window.Resources>
        <local:SetariClassViewModel x:Key="SetariClassViewModelDataSource" d:IsDataSource="True"/>
        <converters:InvertBoolConverter x:Key="InvertBoolConverter" d:IsConverter="True"/>
    </Window.Resources>
    <!--<Window.DataContext> xmlns:vm="clr-namespace:Licenta3.SetariClassViewModelns"
        <vm:SetariClassViewModel/>
    </Window.DataContext>-->
    <Grid x:Name="grid" DataContext="{Binding setarile, Source={StaticResource SetariClassViewModelDataSource}}">

        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Top">
            <TabControl HorizontalContentAlignment="Center" Height="240"
                    >
                <TabItem Header="Autorizati">
                    <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Top">
                        <ComboBox VerticalAlignment="Top"
                            DisplayMemberPath="Nume"
                            SelectedItem="{Binding currentAutorizat, Mode=TwoWay}"
                            SelectedValue="{Binding currentAutorizat.Nume}"
                            SelectedValuePath="Nume" ItemsSource="{Binding lAutorizat}"/>
                        <ListView x:Name="autorizatiListView" Height="157" VerticalAlignment="Top"
                            ItemsSource="{Binding lAutorizat}">
                            <ListView.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="Remove" Click="MenuItem_Click" />
                                </ContextMenu>
                            </ListView.ContextMenu>

                            <ListView.View>
                                <GridView AllowsColumnReorder="False">
                                    <GridViewColumn Header="PFA" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsPF, Mode=TwoWay}"/>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Nume" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding Nume}" BorderBrush="{Binding Background, RelativeSource={RelativeSource Self}}" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Serie" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding Serie}" BorderBrush="{Binding Background, RelativeSource={RelativeSource Self}}" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="SerieCI" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding SerieCI}"
                                                         BorderBrush="{Binding Background, RelativeSource={RelativeSource Self}}"
                                                         IsEnabled="{Binding IsPF}" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="NrCI" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding NrCI}"
                                                         BorderBrush="{Binding Background, RelativeSource={RelativeSource Self}}"
                                                         IsEnabled="{Binding IsPF}"/>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="CNP/CUI" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding id}" BorderBrush="{Binding Background, RelativeSource={RelativeSource Self}}" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Sediu" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <TextBox Text="{Binding adresa.adresaIntreaga}" BorderBrush="{Binding Background, RelativeSource={RelativeSource Self}}" />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="OCPI" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <ComboBox VerticalAlignment="Top"
                                                          ItemsSource="{Binding setarile.lists.OCPI, Source={StaticResource SetariClassViewModelDataSource}, Mode=OneWay}"
                                                          DisplayMemberPath="denumire"
                                                          SelectedItem="{Binding DefaultOCPI, Mode=TwoWay}"
                                                          SelectedValue="{Binding DefaultOCPI.denumire, Mode=OneWay}"
                                                          SelectedValuePath="denumire"
                                                                                                                    />
                                            </DataTemplate>
                                            <!--
                                            SelectedItem="{Binding DefaultOCPI,Mode=OneWay}"
                                                          SelectedValue="{Binding DefaultOCPI.denumire}"
                                                          SelectedValuePath="denumire"
                                            
                                            SelectedItem="{Binding currentAutorizat.DefaultOCPI, Mode=TwoWay}"
                                                          SelectedValue="{Binding currentAutorizat.DefaultOCPI.denumire}"
                                                          SelectedValuePath="denumire"
                                                                                                      SelectedItem="{Binding DefaultBCPI, Mode=OneWay}"
                                                          SelectedValue="{Binding DefaultBCPI.denumire}"
                                                          SelectedValuePath="denumire"
                                            
                                            
                                            
                                            -->
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>
                                    <GridViewColumn Header="BCPI" >
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <ComboBox VerticalAlignment="Top"
                                                          ItemsSource="{Binding DefaultOCPI.BCPI, Mode=OneWay}"
                                                          DisplayMemberPath="denumire"
                                                          SelectedItem="{Binding DefaultBCPI, Mode=TwoWay}"
                                                          SelectedValue="{Binding DefaultBCPI.denumire, Mode=OneWay}"
                                                          SelectedValuePath="denumire"
                                                          />
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>

                                </GridView>
                            </ListView.View>

                        </ListView>


                        <Button Content="Adauga" VerticalAlignment="Bottom" Click="Button_Click"/>

                    </StackPanel>
                </TabItem>
                <TabItem Header="Preferinte">
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="8">
                            <Button Content="Director de Lucru" Click="Button_Click_2"/>
                            <TextBox TextWrapping="Wrap" HorizontalAlignment="Right" Margin="4" Width="390" Text="{Binding LucruPath}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Content="Actualizeaza Lista OCPI/BCPI" Height="30" Width="200" HorizontalAlignment="Left" Margin="8" Click="Button_Click_3"/>
                            <TextBlock x:Name="actualizare" VerticalAlignment="Center"/>
                        </StackPanel>
                    </StackPanel>
                </TabItem>



            </TabControl>
        </StackPanel>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,5,0,5"/>
    </Grid>
</Window>
